using System;

namespace GameOfLife_Console
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Random r = new Random (0);

			while (true) {
				Console.ReadLine ();
				int count = 100;
				bool [,] array = new bool [count, count];
				for (int i = 0; i < count; i ++)
					for (int j = 0; j < count; j++)
						array [i, j] = (int) r.Next (0, 2) == 1;
	
				for (int i = 0; i < count; i++) {
					for (int j = 0; j < count; j++) {
						UpdateColor (array, i, j, count);
						Console.Write (array[i, j] ? "X" : " ");
					}
					Console.BackgroundColor = ConsoleColor.White;
					Console.WriteLine ();
				}
			}
		}

		static void UpdateColor (bool [,] array, int i, int j, int count)
		{
			int alive = 0;
			if (i > 0)
				alive += array [i - 1, j] ? 1 : 0;
			if (j > 0)
				alive += array [i, j - 1] ? 1 : 0;
			if (j + 1 < count)
				alive += array [i, j + 1] ? 1 : 0;
			if (i + 1 < count)
				alive += array [i + 1, j] ? 1 : 0;
			if ((alive < 2 || alive > 3) && array [i, j]) {
				Console.BackgroundColor = ConsoleColor.Red;
			} else if (!array [i, j] && alive == 3) {
				Console.BackgroundColor = ConsoleColor.Green;
			} else {
				Console.BackgroundColor = ConsoleColor.White;
			}
		}
	}
}